#include "main.h"
//#include "gpio.h"
#define KEY1 HAL_GPIO_ReadPin(GPIOB,GPIO_PIN_0)
#define KEY2 HAL_GPIO_ReadPin(GPIOB,GPIO_PIN_1)
#define KEY3 HAL_GPIO_ReadPin(GPIOB,GPIO_PIN_2)
#define KEY4 HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_0)
extern int B1,B2,B3,B4;
extern float fee1;
extern float fee2;
extern int CNBRnum;
extern int VNBRnum;
extern int IDLE;
extern int pwm1;
void key_scan()
{
if(KEY1==GPIO_PIN_RESET)
    {
			while(KEY1==GPIO_PIN_RESET);
			B1=-B1;
    }
if(KEY2==GPIO_PIN_RESET&&B1==-1)
    {
			while(KEY2==GPIO_PIN_RESET);
			fee1=fee1+0.5;
			fee2=fee2+0.5;
    }
if(KEY3==GPIO_PIN_RESET&&fee1>0&&fee2>0&&B1==-1)
    {
			while(KEY3==GPIO_PIN_RESET);
			fee1=fee1-0.5;
			fee2=fee2-0.5;
    }
if(KEY4==GPIO_PIN_RESET)
    {
			while(KEY4==GPIO_PIN_RESET);
			pwm1=-pwm1;
			
    }		
		
}
	